<!doctype html>
<html class="no-js" lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=yes;">
    <meta name="author" content="Kyle">
    <meta name="description" content="Kyle&#39;s Blog">
    <meta name="keywords" content="blog,personal,responsive,search,font awesome,pages,posts,multilingual,highlight.js,syntax highlighting,premium,shortcuts">
    <meta name="generator" content="Hugo 0.72.0" />
    <title> Build Free Blog Website Using Hexo And Github Under Windows | Kyle&#39;s Blog</title>
    <meta name="description" content="Build Free Blog Website Using Hexo And Github Under Windows - Kyle&#39;s Blog">
    <meta itemprop="name" content="Build Free Blog Website Using Hexo And Github Under Windows">
    <meta itemprop="description" content="Build Free Blog Website Using Hexo And Github Under Windows - Kyle&#39;s Blog">
    <meta property="og:title" content="Build Free Blog Website Using Hexo And Github Under Windows">
    <meta property="og:description" content="Build Free Blog Website Using Hexo And Github Under Windows - Kyle&#39;s Blog">
    <meta property="og:image" content="https://www.gravatar.com/avatar/1ec08e2f978d3b7d2742642dfe0113d4?size=200">
    <meta property="og:url" content="https://2019052596.nnm.jnu.rocks/hugo/en/post/hexo-blog-in-windows/">
    <meta property="og:site_name" content="Kyle&#39;s Blog">
    <meta property="og:type" content="article">

    
<link rel="apple-touch-icon" sizes="180x180" href="/hugo/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/hugo/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/hugo/favicon-16x16.png">
<link rel="manifest" href="/hugo/site.webmanifest">
<link rel="mask-icon" href="/hugo/safari-pinned-tab.svg" color="#5bbad5">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="theme-color" content="#ffffff">

    
    <link href="/hugo/en/post/hexo-blog-in-windows/" rel="alternate" type="application/rss+xml" title="Kyle&#39;s Blog" />
    <link href="/hugo/en/post/hexo-blog-in-windows/" rel="feed" type="application/rss+xml" title="Kyle&#39;s Blog" />
    

    

    <link rel="stylesheet" href="https://2019052596.nnm.jnu.rocks/hugo/theme.css">

    

    
    
    
</head>

<body class="bilberry-hugo-theme">

    
    <nav>

    <div class="container">
        <ul class="topnav">
            
            
            <li><a href="https://2019052596.nnm.jnu.rocks/hugo/en/about/">About</a></li>
            
            
            
            <li><a href="https://github.com/kylechoy/hugo-homework" target="_blank">Github</a></li>
            
            
        </ul>

        
        <div id="search-box" class="search">
            <i class="fas fa-search"></i>
            <input id="search" type="text" placeholder="Search ...">
        </div>
        
    </div>
</nav>


    
<header>

    <div class="container">
        <div class="logo">
            <a id="siteBaseUrl" href="/hugo/en" class="logo">
                
                <img src="https://www.gravatar.com/avatar/1ec08e2f978d3b7d2742642dfe0113d4?d=mm&size=200" alt="">
                

                <span class="overlay"><i class="fa fa-home"></i></span>
            </a>
        </div>
        <div class="titles">
            <h3 class="title"><a
                    href="/hugo/en">Kyle&#39;s Blog</a></h3>
            
            <span class="subtitle">Powered by Hugo</span>
            
        </div>

        <div class="languages">
        
            
                <a href="https://2019052596.nnm.jnu.rocks/hugo/">中</a>
            
        
            
                <a href="https://2019052596.nnm.jnu.rocks/hugo/en/" class="active">en</a>
            
        
        </div>
        

        
            <div class="toggler">
                
                <i class="fa fa-bars" aria-hidden="true"></i>
            </div>
        </div>
</header>


    <div class="main container">
        
     
    <div class="article-wrapper u-cf single">
        
            <a class="bubble" href="https://2019052596.nnm.jnu.rocks/hugo/en/post/hexo-blog-in-windows/">
    <i class="fas fa-fw fa-pencil-alt"></i>
</a>

<article class="default article">
    

    <div class="content">
    <h1 class="article-title"><a href="https://2019052596.nnm.jnu.rocks/hugo/en/post/hexo-blog-in-windows/">Build Free Blog Website Using Hexo And Github Under Windows</a></h1>
    <div class="meta">
        
        
        <span class="date moment">2020-04-13</span>
        
        

        

        
        <span class="categories">
            
                
                
                <a href="https://2019052596.nnm.jnu.rocks/hugo/en/categories/website/">Website</a>
                
            
        </span>
        

        
        <span class="author">
            
            
            <a href="https://2019052596.nnm.jnu.rocks/hugo/en/author/kyle/">Kyle</a>
            
        </span>
        
    </div>

    
    <p>This article comes from my blog website：<a href="https://kylechoy.github.io/Windows-%E4%B8%8B%E4%BD%BF%E7%94%A8-Github-%E6%90%AD%E5%BB%BA%E5%85%8D%E8%B4%B9%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2.html">https://kylechoy.github.io</a></p>
<h3 id="install-softwar">Ⅰ、Install Softwar</h3>
<h4 id="1-nodejshttpsnodejsorgendownload">1. <a href="https://nodejs.org/en/download/">Node.js</a></h4>
<p>If in China you can also visit <a href="https://npm.taobao.org/mirrors/node">淘宝 Node.js 镜像</a> .</p>
<h4 id="2-githttpsgit-scmcomdownloadwin">2. <a href="https://git-scm.com/download/win">Git</a></h4>
<p>If in China you can also <a href="https://ww.lanzous.com/b00zedhte">从蓝奏云下载</a></p>
<h4 id="3-hexo">3. Hexo</h4>
<p>Creat a new directory as the workplace of your blog website, right-click your mouse at the blank space of File Manager, press <code>Git Bash Here</code> , then type:</p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">npm install -g hexo-cli
</code></pre></div><p>Then:</p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">hexo init Blog
</code></pre></div><p>The name <code>Blog</code> can be replaced by any words.</p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">cd Blog         <span style="color:#75715e">#Goto workplace</span>
npm install
</code></pre></div><p>Then your workplace will look like this:</p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">├── _config.yml      <span style="color:#75715e">#Config File</span>
├── package.json     <span style="color:#75715e">#Applications&#39;s Config</span>
├── scaffolds        <span style="color:#75715e">#Template</span>
├── source           <span style="color:#75715e">#User&#39;s Resources</span>
|   ├── _drafts      <span style="color:#75715e">#Drafts</span>
|   └── _posts       <span style="color:#75715e">#Posted Articles</span>
└── themes           <span style="color:#75715e">#Themes</span>
</code></pre></div><p>Then:</p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">hexo init
hexo s      <span style="color:#75715e">#s stands for start</span>
</code></pre></div><p>Now use your browser to visit <code>http://localhost:4000</code> and you&rsquo;ll see it!</p>
<h3 id="deploy-hexo-to-github-pages">Ⅱ、Deploy Hexo to GitHub Pages</h3>
<h4 id="1-creat-repository">1. Creat Repository</h4>
<p>Visit <a href="https://github.com/">Github.com</a> , after logging in:</p>
<ul>
<li><code>New Repositorie</code></li>
<li>Write <code>xxx.github.io</code> in <code>Repository name</code></li>
<li>Choose <code>Creat Respository</code></li>
</ul>
<p>Note: xxx can be customized, but not for <strong>.github.io</strong></p>
<h4 id="2-generate-ssh-key-and-add-it-to-github">2. Generate SSH Key and Add it to GitHub</h4>
<ul>
<li>Go back to Git Bash, type:</li>
</ul>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">git config --global user.name <span style="color:#e6db74">&#34;yourname&#34;</span>
git config --global user.email <span style="color:#e6db74">&#34;your@emial.com&#34;</span>
</code></pre></div><p>Input your Github username and mail address.</p>
<ul>
<li>Generate SSH Key:</li>
</ul>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">ssh-keygen -t rsa -C <span style="color:#e6db74">&#34;your@email.com&#34;</span>
</code></pre></div><p>Then edit <code>id_rsa.pub</code> , copy whatever in it.</p>
<p>Add to Github：
<code>Github -&gt; Avatar -&gt; Settings -&gt; SSH and GPG keys -&gt; New SSH Key</code>, paste it.</p>
<h4 id="3-deploy-hexo-to-github">3. Deploy Hexo to Github</h4>
<ul>
<li>Install deploy-git:</li>
</ul>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">npm install hexo-deployer-git --save
</code></pre></div><ul>
<li>Edit Config:</li>
</ul>
<p>open <code>_config.yml</code> , modify the last few lines:</p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">deploy:
  type: git
  repo: git@github.com:UserName/name.github.io.git
  branch: master
</code></pre></div><p>Replace the link after <code>repo</code> as <code>Github -&gt; YourRespository -&gt; Clone or Download -&gt; Use SSH</code>, example:</p>
<p><img src="/hugo/img/SSH.png" alt="SSH"></p>
<ul>
<li>Deploy</li>
</ul>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">hexo clean
hexo generate
hexo deploy
</code></pre></div><p><code>generate</code> and <code>deploy</code> can be replaced by <code>g</code> and <code>d</code> .</p>
<h4 id="4-check-your-website">4. Check Your Website</h4>
<p>Wait for a second and you can visit your website at <code>xxx.github.io</code></p>
<hr>
<p>References:</p>
<p><a href="https://hexo.io/docs/index.html">Hexo Docs</a></p>
<p><a href="https://blog.csdn.net/sinat_37781304/article/details/82729029">Hexo史上最全搭建教程</a></p>
    
</div>

    
<div class="footer">


    
        <div class="tags">
            <i class="fa fa-tags"></i>
            <div class="links">
                
                    
                    
                    <a href="https://2019052596.nnm.jnu.rocks/hugo/en/tags/hexo/">Hexo</a>
                    
                
                    
                    
                    <a href="https://2019052596.nnm.jnu.rocks/hugo/en/tags/github/">Github</a>
                    
                
                    
                    
                    <a href="https://2019052596.nnm.jnu.rocks/hugo/en/tags/blog/">Blog</a>
                    
                
            </div>
        </div>
    

    
    <div class="languages">
        <i class="fa fa-language"></i>
        <div class="links">
            
                <a href="https://2019052596.nnm.jnu.rocks/hugo/post/hexo-blog-in-windows/">中</a>
            
        </div>
    </div>
    
</div>

</article>

        
    </div>

    
        <div id="comments-container">
            
            

            
  
  <div id="vcomments"></div>
  <script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
  <script src='//unpkg.com/valine/dist/Valine.min.js'></script>

  <script type="text/javascript">
    new Valine({
        el: '#vcomments' ,
        appId: 'gUtwUB2rxA9S1cuA7n3nTcCz-gzGzoHsz',
        appKey: 'ql6UYDI0zhNjwElhtBfcv0vh',
        avatar:'mm', 
        placeholder: '说点什么吧...',
        visitor: 'true'
    });
  </script>
        </div>
    

     

    </div>

    
<footer>
    <div class="container">

        
        <div class="recent-posts">
            <strong>Latest posts</strong>
            <ul>
                
                <li>
                    <a href="https://2019052596.nnm.jnu.rocks/hugo/en/post/to-do-list/">To Do List</a>
                </li>
                
                <li>
                    <a href="https://2019052596.nnm.jnu.rocks/hugo/en/quote/tips/">Tips</a>
                </li>
                
                <li>
                    <a href="https://2019052596.nnm.jnu.rocks/hugo/en/post/hello-world/">Hello World</a>
                </li>
                
                <li>
                    <a href="https://2019052596.nnm.jnu.rocks/hugo/en/gallery/grand-theft-auto-5/">Screenshots of GTA5</a>
                </li>
                
                <li>
                    <a href="https://2019052596.nnm.jnu.rocks/hugo/en/post/hexo-blog-in-windows/">Build Free Blog Website Using Hexo And Github Under Windows</a>
                </li>
                
                <li>
                    <a href="https://2019052596.nnm.jnu.rocks/hugo/en/link/kylechoy.top/">Kyle&#39;s Blog</a>
                </li>
                
            </ul>
        </div>
        

        
        <div class="categories">
            <a href="/hugo/en/categories/"><strong>Categories</strong></a>
            <ul>
                
                <li>
                    <a href="/hugo/en/categories/about">About
                        (1)</a>
                </li>
                
                <li>
                    <a href="/hugo/en/categories/games">Games
                        (1)</a>
                </li>
                
                <li>
                    <a href="/hugo/en/categories/learning">Learning
                        (1)</a>
                </li>
                
                <li>
                    <a href="/hugo/en/categories/website">Website
                        (1)</a>
                </li>
                
            </ul>
        </div>
        

        <div class="right">
            
            <div class="external-profiles">
                <strong>Social media</strong>

                
                <a href="https://github.com/kylechoy" target="_blank"><i class="fab fa-github"></i></a>
                
                <a href="http://wpa.qq.com/msgrd?v=3&amp;uin=962972837&amp;site=qq&amp;menu=yes" target="_blank"><i class="fab fa-qq"></i></a>
                
                <a href="https://weibo.com/5017897265" target="_blank"><i class="fab fa-weibo"></i></a>
                
            </div>
            

            <div class="languages">
                <strong>Other languages</strong>
                
                
                <a href="https://2019052596.nnm.jnu.rocks/hugo/">中</a>
                
                
                
                <a href="https://2019052596.nnm.jnu.rocks/hugo/en/" class="active">en</a>
                
                
            </div>
            
        </div>
    </div>
</footer>


<div class="credits">
    <div class="container">
        <div class="copyright">
            <a href="https://github.com/kylechoy" target="_blank">
                &copy;
                
                2020
                
                by Kyle
            </a>
            
        </div>
        <div class="author">
            <a href="https://github.com/KyleChoy/bilberry-hugo-theme"
                target="_blank">Bilberry Hugo Theme</a>
        </div>
    </div>
</div>


    

    


    <script type="text/javascript" src="https://2019052596.nnm.jnu.rocks/hugo/theme.js"></script>

    
    
    

    
    <div id="activate-algolia-search" class="hidden">
  <input type="hidden" id="algolia-search-appId" value="8PHCMX0K5Z">
  <input type="hidden" id="algolia-search-apiKey" value="cbd03d73701a69e7ae8d7d4cbfc5cbba">
  <input type="hidden" id="algolia-search-indexName" value="hugo_index">
  <input type="hidden" id="algolia-search-noSearchResults" value="Nothing found.">

  
  <input type="hidden" id="algolia-search-currentLanguageOnly">
  
</div>

    


</body>

</html>
